/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.util;

import java.io.Serializable;


/** A class representing IVolume
 * An infinitesimal volume element that is represented by sides dx,dy,dz.
 * @author CENOURA!!!
 * @since 24/06/2005
 */
public class IVolume implements Serializable{
    
	private static final long serialVersionUID = 1L;

	/**The dx side.*/
	public double dx = 0.0;
	
	/**The dy side.*/
	public double dy = 0.0;
	
	/**The dz side.*/
	public double dz = 0.0;
	
	/**Constructs and initializes a IVolume to (0,0,0).*/
	public IVolume() {
		dx = 0;
		dy = 0;
		dz = 0;
	}

	/**Constructs and initializes a IVolume from the array of length 3.
	* @param d the array of length 3 containing dxdydz in order
	*/
	public IVolume(double[] d) {
		dx = d[0];
		dy = d[1];
		dz = d[2];
	}
	
	/**Constructs and initializes a IVolume from the specified dxdydz lengths.
	*@param dx the dx side
	*@param dy the dy side
	*@param dz the dz side
	*/
	public IVolume(double dx, double dy, double dz) {
		this.dx = dx;
		this.dy = dy;
		this.dz = dz;
	}
    
    /**Constructs and initializes a IVolume from the specified dxdy lengths with dz=1 (AREA).
    *@param dx the dx coordinate
    *@param dy the dy coordinate
    */
    public IVolume(double dy, double dz) {
        this.dx = 1;
        this.dy = dy;
        this.dz = dz;
    }
    
    /**Constructs and initializes a IVolume from the specified volume v.
     *@param v The specified volume v.
     */
     public IVolume(double v) {
         this.dx = 1;
         this.dy = v;
         this.dz = 1;
     }  
	
	/** Returns the dx of this volume.
	 *  @return The coord dx of this volume.
	 */
	public double getDx(){
  	
  		return dx;
  	
  		}
	
	/** Returns the dy of this volume.
	 *  @return The coord dy of this volume.
	 */
	public double getDy(){
  	
  		return dy;
  	
  		}
	
	/** Returns the dz of this volume.
	 *  @return The coord dz of this volume.
	 */
	public double getDz(){
  	
  		return dz;
  	
  		}
	
	/**Returns the volume of this IVolume.
	* @param v1 the IVolume
	* @return the volume
	*/
	public final double volume() {
		return this.dx*this.dy*this.dz;
	}
}
